#ifndef LVIEW_H
#define LVIEW_H

class ListView
{
	public:
		ListView(HWND hLV);
		~ListView();

		void MeasureItem(LPMEASUREITEMSTRUCT);
		void DrawItem(LPDRAWITEMSTRUCT);
		void updateHeaderWidth(HWND hHeader, INT item);

		void selectItem(INT index);
		INT addItem(TCHAR* name, TCHAR* version, TCHAR* requires, TCHAR* zipname);
		void changeItem(INT index, TCHAR* name, TCHAR* version, TCHAR* zipname);
		INT deleteItem(INT index);

		INT getSelectedItem();

	protected:
		void InitColumns();
		void DrawItemColumn(HDC, LPTSTR, LPRECT, int);
		BOOL CalcStringEllipsis(HDC, LPTSTR, int, UINT);

	protected:
		enum Consts
		{
			NUMCOLS = 4
		};
		HWND hList;
		UINT colwid[NUMCOLS];
};

#endif
